package com.jmb.api.controller.APITEST.asserts;

import com.jmb.api.common.result.Result;
import com.jmb.api.service.ApiTestAssertService;
import com.jmb.api.vo.api.ApiTestAssertVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 接口测试断言
 */

@Slf4j
@Tag(name = "接口测试断言")
@RequestMapping("/api/test/asserts")
@RestController
public class ApiTestAssertsController {
    @Autowired
    private ApiTestAssertService apiTestAssertService;

    @Operation(summary = "保存断言")
    @PostMapping("/sava")
    public Result sava(@RequestBody @Valid ApiTestAssertVo apiTestAssertVo){
        apiTestAssertService.saveAssert(apiTestAssertVo);
        return Result.ok();
    }
    @Operation(summary = "编辑断言")
    @PostMapping("/edit")
    public Result edit(@RequestBody @Valid ApiTestAssertVo apiTestAssertVo){
        apiTestAssertService.editAssert(apiTestAssertVo);
        return Result.ok();
    }
}
